package com.example.a2306_shop.adapter

import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.a2306_shop.R
import com.example.lib_base.entity.Child
import com.example.user.GlideUtils

class TwoAdapter:BaseQuickAdapter<Child,BaseViewHolder>(R.layout.item_two) {
    override fun convert(holder: BaseViewHolder, item: Child) {
        GlideUtils.loadNormal(context,item.extra,holder.getView(R.id.two_iv))
        holder.setText(R.id.two_tv,item.name)
        if(selectedType==item.id){
            holder.getView<TextView>(R.id.two_tv).setTextColor(Color.RED)
        }else{
            holder.getView<TextView>(R.id.two_tv).setTextColor(Color.BLACK)
        }
    }
    var selectedType = 534
    fun setType(type:Int){
        selectedType = type
        notifyDataSetChanged()
    }
}